Create Products
POST /api/v1/Products
Description
This endpoint allows creating a new product.
Headers:
- No specific headers are required.
Path Parameters:
version: The version of the API.
Request Body:
-
Content type: application/json
-
Schema: CreateProductRequest
URL:
- POST:
/api/v1/Products
Response:
- 200: Success, returns the newly created product details.
Error Codes:
-
400: Bad request, the request is not valid.
-
404: Not found, the product does not exist or is invalid.
-
500: Internal server error, something went wrong while processing the request.
Example Request Body:
{
"name": "Product1",
"description": "Description of Product1",
"price": 100.00,
"categoryId": "abc123",
"imageUrl": "https://example.com/product1.jpg",
"availability": true
}
Example Response:
HTTP/1.1 200 OK
{
"id": "123",
"name": "Product1",
"description": "Description of Product1",
"price": 100.00,
"categoryId": "abc123",
"imageUrl": "https://example.com/product1.jpg",
"availability": true,
"createdAt": "2024-02-16T12:00:00Z"
}
Notes:
-
The response includes the ID, name, description, price, category ID, image URL, availability, and creation date of the product.
-
This endpoint can be useful for creating new products and adding them to the system.
Method: POST
/api/v1/Products
Headers
| Content-Type | Value |
|---|---|
Content-Type | application/json |
Headers
| Content-Type | Value |
|---|---|
| Accept | text/plain |
Body (raw)
{
"name": "<string>",
"number": "<string>",
"description": "<string>",
"salesPrice": "<double>",
"documents": [
{
"base64": "<string>",
"fileName": "<string>"
},
{
"base64": "<string>",
"fileName": "<string>"
}
]
}
Response: 200
{
"succeeded": "<boolean>",
"message": "<string>",
"errors": [
"<string>",
"<string>"
],
"data": {
"id": "<uuid>",
"merchantId": "<uuid>",
"name": "<string>",
"number": "<string>",
"description": "<string>",
"salesPrice": "<double>",
"documents": [
{
"id": "<uuid>",
"externalId": "<uuid>",
"url": "<string>",
"name": "<string>"
},
{
"id": "<uuid>",
"externalId": "<uuid>",
"url": "<string>",
"name": "<string>"
}
]
}
}
LANGUAGE
CURL REQUEST
curl --request POST \
--url /api/v1/Products \
--header 'accept: application/json' \
--header 'content-type: application/json'
RESPONSE
Click Try It! to start a request and see the response here!